package com.ghsc.ghxc.jsb.ui.my.activity

import androidx.lifecycle.MutableLiveData
import com.cn.appcore.base.BaseViewModel
import com.cn.appcore.ext.executeResponse
import com.cn.appcore.http.bean.BaseResponse
import com.ghsc.ghxc.jsb.api.ApiMarket
import com.ghsc.ghxc.jsb.ui.my.bean.IntegralResultData
import com.ghsc.ghxc.jsb.ui.my.bean.TeamResultData
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext

/**
 * 项目：GuoHuaJsb
 * 包名：com.ghsc.ghxc.jsb.ui.my.activity
 * 类名：MyTeamVIewModel
 * 创建时间：2024/4/24 16:36
 * 创建人 @author： xiaolin
 * 描述 ：Todo...
 */
class MyTeamVIewModel : BaseViewModel() {

    //我的好有
    val onUserTeamAData: MutableLiveData<BaseResponse<TeamResultData>> = MutableLiveData()
    fun onUserTeamAMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onUserTeamAData(paras) }
            executeResponse(
                response,
                { onUserTeamAData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }

        }
    }



    //我的资产
    val onUserAssetListData: MutableLiveData<BaseResponse<IntegralResultData>> = MutableLiveData()
    fun onUserAssetListMethod(paras: String) {
        launch {
            val response = withContext(Dispatchers.IO) { ApiMarket.service.onUserAssetListData(paras) }
            executeResponse(
                response,
                { onUserAssetListData.value = response},
                { againLoginMsg.value = response.msg}
            ) { errorMsg.value = response.msg }

        }
    }

}